feat: Charter-driven planning + fallback model selection with deterministic retry#13
Merged
Merged
Conversation
… retry and metadata - Add github_fallback_model dispatch input (default: openai/gpt-5) to workflow - Update github_model dispatch input default to anthropic/claude-sonnet-4.5 - Export GITHUB_MODEL and GITHUB_FALLBACK_MODEL as env vars in run step - Add _should_try_fallback() covering 403/404/429/5xx/timeout/model-unavailable - Update call_models_with_fallback_or_none to use _should_try_fallback - Add github_fallback_model to Config, read from GITHUB_FALLBACK_MODEL env var - Add primary_model/fallback_model/model_used/fallback_used to JSON output - Sync workflow_yaml() to match checked-in workflow YAML - Add 19 new tests: TestShouldTryFallback, extended fallback/metadata coverage Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update repo-architect workflow and Python script for GitHub model selection
feat: Primary/fallback GitHub Models selection with deterministic retry and output metadata
Mar 13, 2026
- Add CHARTER_PATHS constant and _MAX_CHARTER_CHARS_PER_FILE limit - Add load_charter_context() to load both charter files tolerantly - Add _charter_system_prefix() helper for model system messages - Inject charter guidance into enrich_with_github_models (report mode) - Inject charter guidance into build_parse_errors_plan, build_import_cycles_plan, build_entrypoint_consolidation_plan (mutate mode) - Include charter metadata (loaded_files, content_hash, applied) in run_cycle and run_campaign JSON output under top-level "charter" key - Add TestCharterContext (9 tests: missing files, partial, full ingestion, metadata in run_cycle/run_campaign, system prefix helpers, hash stability) - Update REQUIRED_OUTPUT_FIELDS and campaign contract to include "charter" Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Copilot
AI
changed the title
feat: Primary/fallback GitHub Models selection with deterministic retry and output metadata
feat: Charter-driven planning + primary/fallback model selection with deterministic retry
Mar 13, 2026
🧪 CI — Python 3.10 |
🧪 CI — Python 3.11 |
There was a problem hiding this comment.
Pull request overview
Adds charter-driven planning and primary/fallback model selection with deterministic retry to repo_architect.py and the repo-architect workflow.
Changes:
- Expanded fallback trigger set (
_should_try_fallback) to cover HTTP 403/404/429/5xx and timeout errors, with newgithub_fallback_modelConfig field and enriched JSON output metadata - Charter context loading (
load_charter_context,_charter_system_prefix) that injects architectural charter guidance into all model calls, with metadata inrun_cycle/run_campaignoutput - Workflow updated with new
github_fallback_modelinput andGITHUB_MODEL/GITHUB_FALLBACK_MODELenv vars
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.github/workflows/repo-architect.yml |
Added github_fallback_model input, changed github_model default, exported both as env vars |
repo_architect.py |
Added _should_try_fallback, load_charter_context, _charter_system_prefix, charter injection in model calls, new metadata fields |
tests/test_repo_architect.py |
Added TestShouldTryFallback (11 tests), extended TestCallModelsWithFallback (6 tests), added TestCharterContext (9 tests), updated output schema assertions |
| description: 'GitHub Models model id (overrides preferred model)' | ||
| required: false | ||
| default: '' | ||
| default: 'anthropic/claude-sonnet-4.5' |
|
@copilot apply changes based on the comments in this thread |
…log resolution Co-authored-by: Steake <530040+Steake@users.noreply.github.com>
Author
Fixed in 6f48bc8. Reverted |
Copilot
AI
changed the title
feat: Charter-driven planning + primary/fallback model selection with deterministic retry
feat: Charter-driven planning + fallback model selection with deterministic retry
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two capabilities added to
repo_architect.pyand therepo-architectworkflow:1. Fallback GitHub Models selection with deterministic retry
workflow_dispatchexposes an explicit fallback model input; the Python layer enforces a narrow, deterministic fallback trigger set. Thegithub_modelinput default remains''so the catalog-based model resolution step remains the primary selection mechanism — an explicit value still overrides it.Workflow (
repo-architect.yml)github_modeldefault remains''(catalog resolution is primary; explicit value overrides)github_fallback_modelinput, defaultopenai/gpt-5GITHUB_MODEL/GITHUB_FALLBACK_MODELenv vars into the run stepPython (
repo_architect.py)_should_try_fallback(msg)— triggers on model unavailability and HTTP 403/404/429/5xx/timeout; bare strings without a status code (e.g."rate limit exceeded") do not triggercall_models_with_fallback_or_noneuses_should_try_fallback; retries exactly once, then surfaces both errors combinedConfig.github_fallback_modelread fromGITHUB_FALLBACK_MODELprimary_model,fallback_model,model_used,fallback_used,fallback_reason2. Charter-driven planning
repo_architect.pynow loads the canonical architectural charters and injects their guidance into every model call.CHARTER_PATHS— canonical tuple of both charter relative pathsload_charter_context(git_root)— reads both files if present (silent on missing), SHA-256 hashes combined content_charter_system_prefix(analysis)— prepends truncated charter text to model system messages (empty when no charter)build_parse_errors_plan,build_import_cycles_plan,build_entrypoint_consolidation_plan,enrich_with_github_models) now receive charter guidance"charter"key:{loaded_files, content_hash, applied}Related Issues
Test Evidence
TestCharterContexttests: no-files tolerance, partial load, both files,run_cycle/run_campaignmetadata schema,_charter_system_prefixbehavior, hash stabilityTestShouldTryFallback/TestCallModelsWithFallbacktests for fallback trigger setChecklist
pytest tests/)black .andisort .)Original prompt
This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.